import React, {Component} from 'react';
import Item from '../item';
import PropTypes from 'prop=types';
import './index.css'

export default class List extends Component {
    //对接受的Props进行：类型，必要性的限制
    static  propType = {
        todos:PropTypes.array.isRequired,
        changeTodo:PropTypes.func.isRequired,
        delateTodo:PropTypes.func.isRequired,
    }
    render(){
        const {todos,changeTodo,deleteTodo} =this.props;
        return (
            <ul className="todo-main">
                {
                    todos.map((todo)=>{
                        return <Item key={todo.id} {...todo} changeTodo={changeTodo} deleteTodo={deleteTodo}/>
                    })
                }
            </ul>
        )
    }
}